package com.djmw.mouse.web.admin;

import java.util.List;

import javax.servlet.ServletRequest;
import javax.validation.Validator;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.djmw.mouse.entity.PositionType;
import com.djmw.mouse.service.PositionTypeService;

/**
 * 查看职位类型信息的Controller, 使用Restful风格的Urls:
 * 
 * List page : GET /admin/position<br>
 * 
 * @author michael
 */

@Controller
@RequestMapping(value = "/admin/position")
public class PositionTypeController {

    @Autowired
    private PositionTypeService positionTypeService;
    @Autowired
    private Validator validator;

    @RequestMapping(value = "")
    public String list(Model model, ServletRequest request) {
        List<PositionType> allPosition = positionTypeService.getAllPositionTypes();
        model.addAttribute("positions", allPosition);

        return "admin/position/position-list";
    }
}
